home *** CD-ROM | disk | FTP | other *** search
-
- Listing 5
-
- /*
- * scan.c
- */
- #include <ctype.h>
- #include <limits.h>
- #include <stdio.h>
-
- #include "scan.h"
-
- int yylex(void)
- {
- int c;
-
- while (isspace(c = getchar()) && c != '\n')
- ;
- if (isdigit(c))
- {
- yylval = 0;
- do
- yylval = 10 * yylval + c - '0';
- while (isdigit(c = getchar()));
- ungetc(c, stdin);
- return INT;
- }
- return c;
- }
-
- void yyrestart(void)
- {
- int c;
-
- while ((c = getchar()) != '\n')
- ;
- }
-
-